# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=liblouis
pkgver=3.27.0
pkgrel=1
pkgdesc='Braille translator and back-translator library'
arch=('loong64' 'x86_64')
url='https://liblouis.io/'
license=('LGPL3' 'GPL3')
depends=('glibc')
makedepends=('help2man' 'libyaml' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
optdepends=('libyaml: lou_checkyaml command'
            'python: Python bindings')
source=("https://github.com/liblouis/liblouis/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('b3f1526f28612ee0297472100e3d825fcb333326c385f794f5a9072b8c29615d')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --enable-ucs4
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make

  cd python
  python -m build --wheel --no-isolation
}

check() {
  cd $pkgname-$pkgver
  make check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  cd python
  python -m installer --destdir="$pkgdir" dist/*.whl
}
